const KEY = {
    VIS_ACCESS_TOKEN: "VIS_ACCESS_TOKEN",
    VIS_REFRESH_TOKEN: "VIS_REFRESH_TOKEN",
    VIS_TAB_VIEW_DATA: "VIS_TAB_VIEW_DATA",
}

export const $cache = {
    setAccessToken: (accessToken: string) => {
        localStorage.setItem(KEY.VIS_ACCESS_TOKEN, accessToken)
    },
    getAccessToken: (): string => {
        return localStorage.getItem(KEY.VIS_ACCESS_TOKEN)
    },
    //
    setRefreshToken: (refreshToken: string) => {
        localStorage.setItem(KEY.VIS_REFRESH_TOKEN, refreshToken)
    },
    getRefreshToken: (): string => {
        return localStorage.getItem(KEY.VIS_REFRESH_TOKEN)
    },
    //
    setTabViewData: (tabViewData: object) => {
        localStorage.setItem(KEY.VIS_TAB_VIEW_DATA, JSON.stringify(tabViewData))
    },
    getTabViewData: (): object => {
        let tabViewData = localStorage.getItem(KEY.VIS_TAB_VIEW_DATA)
        if (tabViewData && tabViewData !== 'undefined') return JSON.parse(tabViewData)
        return []
    }

}


